#ifndef _OSIP_NET_H_
#define _OSIP_NET_H_

#include "internal.h"

#ifdef __cplusplus
extern "C" {
#endif

int fdClose(socket_t& fd);

int tcp_sockopt(socket_t fd);

int udp_sockopt(socket_t fd);

int listen_sockopt(socket_t fd);

int thread_name(socket_t fd,const char* name);

int net_localaddr(socket_t s, struct sockaddr* addr);

int net_remotaddr(socket_t s, struct sockaddr* addr);

int tcp_sendmessage(socket_t fd,const char* data, int len);

int tcp_bind(socket_t* fd, const char* ip, unsigned short nPort);

int udp_bind(socket_t* fd, const char* ip, unsigned short nPort);

int tcp_listen(socket_t* fd, const char* ip, unsigned short nPort);

int initListenFd(unsigned short port);

int tcp_client(socket_t* fd, const char* ip, unsigned short nPort);

int tcp_connect(socket_t s, const char* ip, unsigned short nPort, int tm=3);

int udp_sendmessage(socket_t fd,const char* data, int len,sockaddr_in* addr);

int ipv4_addr(struct sockaddr_in* addr, const char* ip, unsigned short nPort);


#ifdef __cplusplus
}
#endif

#endif

